{template 'common/header'}
<div class="panel we7-panel ng-scope" >
	<div class="panel-heading">添加技师</div>
	<div class="panel-body we7-padding">
		<div class="form-horizontal">
			<div class="form-group">
				<label class="col-sm-2 control-label">技师名称</label>
				<div class="col-sm-8">
					<input type="text" class="form-control" id="tname" name="tname" value="{$tech['tname']}">
				</div>
		 	</div>
	        <div class="form-group">
	            <label class="col-sm-2 control-label">技师等级</label>
	           	<div class="col-sm-4">
					<input type="text" class="form-control" id="leve" placeholder="四个字之内"  name="leve" value="{$tech['leve']}">
					<span class="help-block">&nbsp;&nbsp;例如：金牌技师 </span>	
				</div>
	            <div class="col-sm-6">
	            	{php echo tpl_form_field_color('leve_color', $tech['leve_color']);}
	            </div>
	        </div>
			<div class="form-group">
				<label class="col-sm-2 control-label">技师映像</label>
				<div class="col-sm-8">
					  {php echo tpl_form_field_image('avatar',$tech['avatar']);}
				</div>
		 	</div>		        
			<div class="form-group">
				<label class="col-sm-2 control-label">擅长技能</label>
				<div class="col-sm-8">
					<input type="text" class="form-control" id="skill" name="skill" value="{$tech['skill']}">
					<span class="help-block">&nbsp;&nbsp;多个请以||分割</span>
				</div>				
		 	</div>
	        <div class="form-group">
	            <label class="col-sm-2 control-label">技师所属分类</label>
	            <div class="col-sm-8">            
	                <input type="text" value=""  readonly="readonly" name="tag" id="tag" data-title="技师所属分类" data-multiple="true" data-maxnum="8" data-width="582" class="form-control tag_code_title"/>
	                <input class="tag_code" name="tag" id="tag" type="hidden" value="{$tech['classid']}" />
	            </div>
	        </div>		 		         	 		
			<div class="form-group">
				<label class="col-sm-2 control-label">上班/下班时间</label>
				<div class="col-sm-4">
					<input type="text" class="form-control" id="onlinestart" name="onlinestart" value="{$tech['onlinestart']}">
					<span class="help-block">&nbsp;&nbsp;例如：08:00-20:30</span>	
				</div>
				<div class="col-sm-4">
					<input type="text" class="form-control" id="onlineend" name="onlineend" value="{$tech['onlineend']}">
				</div>				
		 	</div>	  			 		
			<div class="form-group">
				<label class="col-sm-2 control-label">技师寄语</label>
				<div class="col-sm-8">
					<textarea class="form-control" id="message" rows="3" >{$tech['message']}</textarea>
				</div>
		 	</div>				 	
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">作品图集</label>
				<div class="col-sm-8">
					{php echo tpl_form_field_multi_image('opus',$opus);}
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">显示排序</label>
				<div class="col-sm-8">
					<input type="number" class="form-control" id="orderid" name="orderid" value="{$tech['orderid']}">
				</div>
		 	</div>	

	  	   <div class="form-group">
	    	<label class="col-sm-2 control-label">时间看板</label>
	    	<div class="col-sm-8">
		    <select class="form-control"  id="timetemplate" name="timetemplate">
		    	{if $timetemplate}
		    	{loop $timetemplate $k $t}
		    	<option value="{$t['tid']}" {if $tech['timetemplate_id']==$t['tid']}selected="selected"{else}{/if}>{$t['template_name']}</option>
		    	{/loop}
		    	{else}
		    	{/if}
		     </select>
		    </div>
		   </div>

			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">技师状态</label>
				<div class="col-xs-12 col-sm-8">
					<label class="radio radio-inline">
						<input type="radio" name="status" id="status" value="0" {if intval($tech['status']) != 1}checked="checked"{/if}> 下线
					</label>
					<label class="radio radio-inline">
						<input type="radio" name="status" id="status" value="1" {if intval($tech['status']) == 1}checked="checked"{/if}> 上线
					</label>
				</div>
			</div>
			<button type="button" id="save_" class="btn btn-info" style="display: block; margin-left: auto;margin-right: auto;">提交保存</button>
		</div>
	</div>	
</div>
<style type="text/css">.right-content{padding: 0;}</style>
<link rel="stylesheet" href="{MODULE_URL}template/web/css/miiselectdata.css">
<link rel="stylesheet" href="{MODULE_URL}public/css/Toast.css">
<!-- <script src="{MODULE_URL}public/{$_W['uniacid']}/databese.js?ver={$_W['timestamp']}"></script> -->
<script src="{MODULE_URL}template/web/js/selectdata.js?ver={$_W['timestamp']}"></script> 	
<script src="{MODULE_URL}public/js/Toast.js"></script>
<script type="text/javascript">
	var MQ_jobtag = new Array("all,全部分类",{$classArr});
	$("#save_").on(
    	"click",function(){
    	var oid = '{$oid}';	
    	var tname = $.trim($('#tname').val());	
    	var leve = $.trim($('#leve').val());
    	var onlinestart = $.trim($('#onlinestart').val());
    	var onlineend = $.trim($('#onlineend').val());
    	var message = $.trim($('#message').val());
    	var skill  = $.trim($('#skill').val());
    	var avatar = $.trim($('input[name="avatar"]').val());
    	var leve_color = $.trim($('input[name="leve_color"]').val());
		var opusArr = $('input[name="opus[]"]').map(function(){return $(this).val()}).get();
	    var opus = opusArr.join(',');  
		var status = $.trim($('input[name="status"]:checked').val());
		var orderid = $.trim($('#orderid').val()); 
		var classid  = $.trim($('.tag_code').val()); 
		var timetemplate_id = $.trim($('#timetemplate option:selected').val());
	    if(tname==''){
	    	mqToast({type:1,context: '请填写技师名称'});
	    	return false;
	    }
	    if(skill==''){
	    	mqToast({type:1,context: '请填写擅长技能'});
	    	return false;	    	
	    }

	    if(leve==''){
	    	mqToast({type:1,context: '请填写技师等级'});
	    	return false;
	    }
	    if(leve_color==''){
	    	mqToast({type:1,context: '请设置技师等级背景色'});
	    	return false;	    	
	    }	    
	    if(opusArr==''){
	    	mqToast({type:1,context: '请上传作品图集，至少一张'});
	    	return false;

	    }
	    if(classid==''){
	    	mqToast({type:1,context: '请选择技师所属分类'});
	    	return false;	    	
	    }
	    if(timetemplate_id==''){
			mqToast({type:1,context: '请选择时间看板'});
	    	return false;
	    }	    	
		$.ajax({
			url:"{php echo $this->createWebUrl('save_techedit');}&version_id="+"{$_GPC['version_id']}",
			data:{oid:oid,tname:tname,leve:leve,onlinestart:onlinestart,onlineend:onlineend,message:message,skill:skill,leve_color:leve_color,opus:opus,status:status,orderid:orderid,classid:classid,avatar:avatar,timetemplate_id:timetemplate_id},
			dataType:"json",
			type:"post",
			success:function(res){
				if(res.status==1){
					mqToast({type:1,context:res.msg});
					return false;
				}else{
					mqToast({type:2,context:res.msg});
					return false;
				}
			}
		});		    
    });


</script>

{template 'common/footer'}